package com.ctgu.zmc.stresstest.common.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author ZMC
 * @description 分页查询参数
 * @date 2022/9/6 14:02
 */
@Data
@AllArgsConstructor
@ApiModel("分页查询参数")
public class PageParams implements Serializable {

    private static final long serialVersionUID = 8623468181983035254L;

    /**
     * 当前页码
     */
    @ApiModelProperty("当前页码")
    @NotNull(message = "当前页码不能为null")
    @Min(value = 1L, message = "当前页码必须大于或等于1")
    private Long pageNo;

    /**
     * 页面大小
     */
    @ApiModelProperty("页面大小")
    @NotNull(message = "页面大小不能为null")
    @Min(value = 10L, message = "页面大小必须大于或等于10")
    @Max(value = 1000L, message = "页面大小必须小于或等于1000")
    private Long pageSize;

    public PageParams() {
        this.pageNo = 1L;
        this.pageSize = 10L;
    }

}